{% extends 'myadmin/index.html' %}
{% block title %}
<title>后台-会员添加</title>
{% endblock %}
{% block app %}
    <link rel="stylesheet" href="/static/myadmin/css/app1.css" />
    {% endblock %}
{% block main %}
<div class="row-content am-cf">
<script type="text/javascript" src="/static/myadmin/js/jquery.min.js"></script>
  <div class="row">
    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
      <div class="widget am-cf">
        <div class="widget-head am-cf">
          <div class="widget-title am-fl">线条表单</div>
          <div class="widget-function am-fr">
            <a href="javascript:;" class="am-icon-cog"></a>
          </div>
          <div class="am-btn-group am-btn-group-xs" style="margin-left: 50px">
                  <a href="{% url 'myadmin_goods_index' %}?p={{request.GET.p}}&types={{request.GET.types}}&textVal={{request.GET.textVal}}" class="am-btn am-btn-default am-btn-success">
                    <span class="am-icon-plus"></span>返回</a>
                </div>
        </div>
        <div class="widget-body am-fr">
          <form class="am-form tpl-form-line-form" action="{% url 'myadmin_goods_update' d.id %}?p={{request.GET.p}}&types={{request.GET.types}}&textVal={{request.GET.textVal}}" method="post" enctype="multipart/form-data">
          {% csrf_token %}
          <div class="am-form-group">
                <label for="user-name" class="am-u-sm-3 am-form-label">所属分类</label>
                <div class="am-u-sm-9">
                {% load pagetag %}
                    <select name="id" data-am-selected="{btnSize: 'sm'}">
                        <option value="0">点击选择</option>
                        {% for i in data %}

                        <option {% if d.cateid.id == i.id %} selected {% endif %} {% if i.pid == 0 %} disabled {% endif %} value="{{ i.id }}"><span></span>{% sj i.path %}{{ i.name }}</option>
                        
                        {% endfor %}
                    </select>
                </div>
            </div>
            <div class="am-form-group">
              <label for="user-name" class="am-u-sm-3 am-form-label">商品标题
                <span class="tpl-form-line-small-title"></span></label>
              <div class="am-u-sm-9">
                <input type="text" class="tpl-form-input"placeholder="请输入用户名" name='title' value="{{d.title}}">
                <small></small></div>
            </div>
            <div class="am-form-group">
              <label for="user-name" class="am-u-sm-3 am-form-label">商品价格
                <span class="tpl-form-line-small-title"></span></label>
              <div class="am-u-sm-9">
                <input type="Number" class="tpl-form-input"  placeholder="请输入密码" name="price" value="{{d.price}}">
                <small></small></div>
            </div>
            <div class="am-form-group">
              <label for="user-name" class="am-u-sm-3 am-form-label">商品库存
                <span class="tpl-form-line-small-title"></span></label>
              <div class="am-u-sm-9">
                <input type="Number" class="tpl-form-input" placeholder="请输入手机号" name="store" value="{{d.store}}">
                <small></small></div>
            </div>
            
  			  <div class="am-form-group">
                            <label for="user-weibo" class="am-u-sm-3 am-form-label">
                                商品主图
                            </label>
                            <div class="am-u-sm-9">
                                <div class="am-form-group am-form-file">
                                    <div class="tpl-form-file-img">
                                        <img src="{{d.pic_url}}" alt="" width="100" id="imgs"></div>
                                    <button type="button" class="am-btn am-btn-danger am-btn-sm">
                                        <i class="am-icon-cloud-upload"></i>添加头像图片</button>
                                    <input name="pic_url" id="doc-form-file" type="file" multiple="" onchange="up(this)"></div>
                            </div>
                            <script type="text/javascript">
                            function up(pram){
                                  var file = pram.files[0];
                             if (window.FileReader) {    
                                      var reader = new FileReader();    
                                      reader.readAsDataURL(file);    
                                      //监听文件读取结束后事件    
                                    reader.onloadend = function (e) {
                                      $("#imgs").attr("src",e.target.result);    //e.target.result就是最后的路径地址
                                      };    
                                 } 
                            }
                            </script>
              </div>
             <!--  <div class="am-form-group">
              <label for="user-name" class="am-u-sm-3 am-form-label">商品简介
                <span class="tpl-form-line-small-title"></span></label>
              <div class="am-u-sm-9">
                <input type="text" class="tpl-form-input" placeholder="请输入手机号" name="info" value="">
                <small></small></div>
            </div> -->
            <link rel="stylesheet" type="text/css" href="/ueditor/UE/third-party/SyntaxHighlighter/shCoreDefault.css">
              <script type="text/javascript" src="/ueditor/UE/third-party/SyntaxHighlighter/shCore.js"></script>
              <script type="text/javascript" src="/ueditor/UE/ueditor.config.js"></script>
              <script type="text/javascript" src="/ueditor/UE/ueditor.all.min.js"></script>
              <script type="text/javascript" src="/ueditor/UE/lang/zh-cn/zh-cn.js"></script>


              <div class="am-form-group">
                  <label for="user-intro" class="am-u-sm-3 am-form-label">商品简介</label>
                  <div class="am-u-sm-9" >
                      <!-- <textarea name="descr" class="" rows="10" id="user-intro" placeholder="请输入商品简介"></textarea> -->
                      <!-- <script id="editor" type="text/plain" style="width:100%;height:500px;"></script> -->
                      <script id="editor" name="info" type="text/plain" style="height:500px;color:red;">
                        {{d.info|safe}}
                      </script>
                  </div>
              </div>
              <script type="text/javascript">
                  var ue = UE.getEditor('editor');
                  SyntaxHighlighter.all();
              </script>
    </div>
            <div class="am-form-group">
              <div class="am-u-sm-9 am-u-sm-push-3">
                <button class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button></div>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
{% endblock %}